<?php
class ViewAction extends ActionBase {
	public $modelName;
	public $detailView = array();	
	
	public function run($id) {
		$this->prepare();
		$c = $this->controller;
		
		$modelName = $this->modelName;
		$model = $c->loadModel($id);
		
		$config = $this->detailView;
		$config['data'] = $model;
		
		
		if(!isset($config['attributes'])) {
			foreach($model->attributeNames() as $one) {
				$config['attributes'][] = $one;
			}
		}
		$c->render($this->view, array(
			'model' => $model,
			'detailView' => $config,
		));
		
	}
}
